import type { PropType } from 'vue';
import type { ColEx, FormSchema, Recordable, RowProps } from './types/form';
import type { Fn } from './common/gloab';
import type { ButtonProps, FormRules } from 'element-plus';
import { propTypes } from '#/types/propTypes';
// 表单相关默认值
export const basicFormProps = {
  rules: {
    type: Array as unknown as PropType<FormRules>,
    default: [],
  },
  inline: {
    type: Boolean,
  },
  labelPosition: propTypes.string.def('right'), //表单域标签的位置

  // 标签宽度  固定宽度
  labelWidth: {
    type: [Number, String] as PropType<number | string>,
    default: 0,
  },
  // 表单配置规则
  schemas: {
    type: Array as PropType<FormSchema[]>,
    default: () => [],
  },
  rulesMessageJoinLabel: propTypes.bool.def(true),
  labelSuffix: propTypes.string,
  hideRequiredAsterisk: propTypes.bool.def(false), //是否隐藏必填字段标签旁边的红色星号
  requireAsteriskPosition: propTypes.string.def('left'),
  showMessage: propTypes.bool,
  inlineMessage: propTypes.bool,
  statusIcon: propTypes.bool,
  validateOnRuleChange: propTypes.bool,
  size: propTypes.string,
  disabled: propTypes.bool,
  scrollToError: propTypes.bool,
  rowProps: {
    type: Object as PropType<RowProps>,
  },
  mergeDynamicData: {
    type: Object as PropType<Recordable>,
  },

  baseColProps: {
    type: Object as PropType<Partial<ColEx>>,
  },

  // 转化时间
  transformDateFunc: {
    type: Function as PropType<Fn>,
    default: (date: any) => {
      return date?.format?.('YYYY-MM-DD HH:mm:ss') ?? date;
    },
  },
  showAdvancedButton: propTypes.bool,
  alwaysShowLines: propTypes.number,
  autoAdvancedLine: propTypes.number,
  emptySpan: propTypes.number,
  // 是否显示操作按钮
  showActionButtonGroup: propTypes.bool.def(true),
  // 显示重置按钮
  showResetButton: propTypes.bool.def(true), // 重置按钮配置
  resetButtonOptions: Object as PropType<Partial<ButtonProps>>,

  // 显示确认按钮
  showSubmitButton: propTypes.bool.def(true),
  // 确认按钮配置
  submitButtonOptions: Object as PropType<Partial<ButtonProps>>,
  submitOnReset: propTypes.bool,
  actionColBool: propTypes.bool.def(false),
};
